Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Exercise

Sven

Sven wants to publish an alphabetical list of city parks for his team. His workspace reads parks data from MapInfo and writes a Geodatabase dataset. The parks sort correctly by name, but the unnamed parks land at the top of the table, and Sven wants them written as nulls at the very end.

In this exercise, you will:

1) Open and Run the Starting Workspace

Running the workspace first shows you the problem you need to solve. By default, FME sorts <null>, <missing>, and empty values to the top of a column, in both Data Preview column sorting and Sorter output. That default helps you spot them while inspecting data, but it works against you when they need to be written last.

Caching button enabled

Parks data with missing values scattered throughout

2) Map Missing Values to a Placeholder

You will fix this in two passes. In this first pass, you set the missing ParkName values to something that sorts to the bottom of an alphabetical list, and a later step maps them back to <null>.

Choosing the Selected Attributes in the NullAttributeMapper

Mapping missing attribute values to a new value of ZZZ

3) Map the Placeholder Back to Null

The second pass runs after the sort, so the parks are already in the right order by the time you restore the nulls.

Mapping ZZZ to null

4) Save and Run the Workspace

This run confirms that both mappings work together. The parks should now sort by name with the unnamed parks at the end rather than the top.

Resulting data with null values at the bottom

5) Fix RefParkId Values

Sven now wants the RefParkId field fixed as well. Many of its values are -9999, the MapInfo equivalent of nothing, and the Geodatabase should hold proper nulls instead. The fix is straightforward, so try working it out before you read the steps below.

Mapping missing or -9999 values to ZZZ

Challenge

The requirements have changed. Sven no longer wants the incomplete parks written to the main table at all. Any record where either ParkName or RefParkId is null should be filtered out and written to a separate feature type in the Geodatabase. Work through this challenge before you attempt the quiz question below, because you will need the result.

In this challenge, you will:

Challenge Answer: Open after attempting the challenge.

🔍 Check your results

Open the completed workspace: Advanced Complete Workspace (C:\FMEData\Workspaces\AdvancedDataTransformation\handle-null-and-missing-values-advanced-complete.fmw).